<?php

use Pinenut\Config;

class FormConfig extends Config
{
	static $config = [
		'htmlOptions' => array(
			'method' => 'POST',
		),
		'elements' => array(
			'name' => array(
				'type' => 'text',
				'filters' => 'trim',
				'validators' => [
					'notEmpty' => [
						'errorMessage' => 'Name field is empty'
					]
				],
				'label' => 'Имя',
			),
//			'password' => array(
//				'type' => 'password',
//				'htmlOptions' => array('placeholder' => 'Пароль'),
//				'validators' => 'notEmpty',
//			),
			'city' => array(
				'type' => 'select',
				'label' => 'Город',
				'options' => ['very_big' => 'Очень большой', 'big'=>'Большой', 'small' => 'Маленький'],
//				'slaveElements' => ['big'=>['district'], 'very_big'=>['zone'], 'street'],
			),
			'street' => array(
				'master' => 'city',
				'type' => 'text',
				'label' => 'Улица',
			),
			'district' => array(
				'master' => 'city',
				'type' => 'text',
				'label' => 'Район',
			),

			'email' => array(
				'type' => 'text',
				'label' => 'E-mail',
				'validators' => [
					'email' => [
						'errorMessage' => 'Wrong email address'
					]
				],
			),				
				
			'on' => array(
					'type' => 'checkbox',
					'label' => 'вкл.',
			),
			'age' => array(
				'type' => 'text',
				'label' => 'Возраст',
				'validators' => [
					'digits' => [
						'errorMessage' => 'Age is not a number'
					],
					'notEmpty' => [
						'errorMessage' => 'Age field is empty'
					]
				],
			),
			'langs' => array(
						'type' => 'multicheckbox',
						'label' => 'Языки',
						'options' => ['eng', 'rus', 'ger'],
			),
				'password' => array(
						'type' => 'password',
						'label' => 'Password',
				),

				'textarea' => array(
						'type' => 'textarea',
						'label' => 'textarea',
				),
				
			'submit' => array(
				'label' => 'Добавить',
				'type' => 'submit',
			),
		),
	];
}